package com.wyl.mine.setting

import com.wuhenzhizao.titlebar.widget.CommonTitleBar
import com.wyl.base.ACacheHelper
import com.wyl.base.LoginPage
import com.wyl.libbase.base.BindingActivity
import com.wyl.libbase.extend.openActivity
import com.wyl.libbase.utils.ActivityStack
import com.wyl.mine.R
import com.wyl.mine.databinding.SettingActivityBinding

class SettingActivity : BindingActivity<SettingActivityBinding>() {
    override fun getLayoutId(): Int = R.layout.setting_activity

    override fun initView() {
        binding.vm = this

        binding.titlebar.setListener { _, action, _ ->
            when (action) {
                CommonTitleBar.ACTION_LEFT_BUTTON -> onBackPressed()
                else -> {
                }
            }
        }
    }

    override fun loadData() {

    }

    fun openLoginPwdPage() = openActivity(VerificationActivity::class.java)

    fun openAgreementPage() = openActivity(ServiceActivity::class.java)

    fun logout() {
        ACacheHelper.logout()
        ActivityStack.screenManager.popAllActivitys()
        openActivity(LoginPage)
    }

}
